package Solution_4;

/**
 * 学号、姓名、年龄
 */
public class Student {
    public Student(int id,String name,int age){
        this.id = id;
        this.name = name;
        this.age = age;
    }
    private int id;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    private String name;
    private int age;

    @Override
    public boolean equals(Object obj) {
        if (obj == this) return true;
        if (obj == null ) return false;
        if (obj instanceof Student){
            Student o = (Student)obj;
            return o.getId() == this.getId();
        }
        return false;
        //return super.equals(obj);
    }

    @Override
    public int hashCode() {

        return this.getId()>>>16 ^ this.getId()  ;
    }

    @Override
    public String toString() {
        return "学号 ：" + this.id + " , 姓名 ： " + this.name + ", 年龄 ：" + this.age;
    }
}
